package cn.iocoder.yudao.module.system.controller.admin.mini.orderInfo.back.dal.mysql.back;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.controller.admin.mini.orderInfo.back.controller.admin.back.vo.BackExportReqVO;
import cn.iocoder.yudao.module.system.controller.admin.mini.orderInfo.back.controller.admin.back.vo.BackPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.mini.orderInfo.back.dal.dataobject.back.BackDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 退/换货 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface BackMapper extends BaseMapperX<BackDO> {

    default PageResult<BackDO> selectPage(BackPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BackDO>()
                .betweenIfPresent(BackDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(BackDO::getContent, reqVO.getContent())
                .eqIfPresent(BackDO::getUrls, reqVO.getUrls())
                .eqIfPresent(BackDO::getPrice, reqVO.getPrice())
                .eqIfPresent(BackDO::getTitle, reqVO.getTitle())
                .eqIfPresent(BackDO::getType, reqVO.getType())
                .eqIfPresent(BackDO::getStatus, reqVO.getStatus())
                .eqIfPresent(BackDO::getCode, reqVO.getCode())
                .eqIfPresent(BackDO::getGoods, reqVO.getGoods())
                .eqIfPresent(BackDO::getOrderId, reqVO.getOrderId())
                .eqIfPresent(BackDO::getLogistic, reqVO.getLogistic())
                .betweenIfPresent(BackDO::getLogisTime, reqVO.getLogisTime())
                .betweenIfPresent(BackDO::getBusinTime, reqVO.getBusinTime())
                .orderByDesc(BackDO::getId));
    }

    default List<BackDO> selectList(BackExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BackDO>()
                .betweenIfPresent(BackDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(BackDO::getContent, reqVO.getContent())
                .eqIfPresent(BackDO::getUrls, reqVO.getUrls())
                .eqIfPresent(BackDO::getPrice, reqVO.getPrice())
                .eqIfPresent(BackDO::getTitle, reqVO.getTitle())
                .eqIfPresent(BackDO::getType, reqVO.getType())
                .eqIfPresent(BackDO::getStatus, reqVO.getStatus())
                .eqIfPresent(BackDO::getCode, reqVO.getCode())
                .eqIfPresent(BackDO::getGoods, reqVO.getGoods())
                .eqIfPresent(BackDO::getOrderId, reqVO.getOrderId())
                .eqIfPresent(BackDO::getLogistic, reqVO.getLogistic())
                .betweenIfPresent(BackDO::getLogisTime, reqVO.getLogisTime())
                .betweenIfPresent(BackDO::getBusinTime, reqVO.getBusinTime())
                .orderByDesc(BackDO::getId));
    }

}
